﻿using Grundy.Common;
using Grundy.Licensing.Server.Command;

namespace Grundy.Licensing.Server
{
    public class LicenseServiceFactory
    {
        private readonly IApplication _application;

        public LicenseServiceFactory(IApplication application)
        {
            _application = application;
        }
        
        public virtual LicenseService Get()
        {
            var licenseSessionStore = _application.LicenseSessionStore;
            var commands = new ICommand[] { new ServerCommand(), new CheckoutCommand(licenseSessionStore), new CheckinCommand(licenseSessionStore), new ReassertCommand(licenseSessionStore), new GetInstalledLicensesCommand()};
            return new LicenseService(commands);
        }
    }
}